package com.example.lijianwen.widgettest_401ljw;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class newActivity extends AppCompatActivity implements View.OnClickListener {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new);

        Intent intent = getIntent();
        String str = intent.getStringExtra("p2");
        int n = intent.getIntExtra("p1",0);
        System.out.println("-----"+str+"-------"+String.valueOf(n));
        //Toast显示
        Toast.makeText(this, str+"--"+String.valueOf(n), Toast.LENGTH_SHORT).show();
        TextView tv = (TextView)findViewById(R.id.textView3);

        tv.setText(str+"--"+String.valueOf(n));
        Button b = (Button) findViewById(R.id.button4);
        b.setOnClickListener(this);

    }

    public void onClick(View v){
        switch(v.getId()){
            case R.id.button4:
                finish();
        }
    }
}
